#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int n;
	scanf("%d",&n);
	int i = 1;
	int first = 1;
	while (i < n) {
		first *= 10;
		i++;
	}
	i = first;
	int t;
	while (i < first * 10) {
		t = i;
		int sum = 0;
		while (t > 0) {
			int j = t % 10;
			t /= 10;
			int b = 0;
			int p = 1;
			while (b<n) {
				p *= j;
				b++;
			}
			sum += p;
		}
		if (sum == i) {
			printf("%d\n", i);
		}
		i++;
	}
	return 0;
}